<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>创建抽奖活动</title>
<link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/dpl.css" rel="stylesheet">
<link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/bui.css" rel="stylesheet">
<script src="/assets/js/jquery-1.8.1.min.js"></script>
<script src="http://g.alicdn.com/bui/seajs/2.3.0/sea.js"></script>
<script src="http://g.alicdn.com/bui/bui/1.1.21/config.js"></script>
<script src="/assets/shopmanage/global_menu_jquery.js"></script>
<script src="/assets/shopmanage/event_addgift.js"></script>
	<style>
	h1 button,h2 button,h3 button,h4 button,.title button,.gift_hqfs button,.title a{ldelim}position:absolute{rdelim}
	a.js-edit {ldelim}margin-left:5px{rdelim}
	</style>
</head>
<body style="width:990px;margin:0 auto;padding:10px 0;">
<input type="hidden" class="eid" value="{$eid|default:""}" />
<input type="hidden" class="curtool" value="{$curtool}" />
<input type="hidden" class="setting" value="{$tool_info.templet_code|default:""}" />
<input type="hidden" class="setting_pic" value="{$tool_info.pic_url|default:""}" />
<input type="hidden" class="left_prob" value="{$left_prob|string_format:"%d"}" />
<input type="hidden" class="preview" value="" />
 <div class="doc-content">
    <div class="panel">
      <div class="panel-body">
		  <div class="row">
			<div class="span24 doc-content">
			<h3 class="pull-left">我的互动 >> 抽奖活动 >> 创建抽奖活动</h3>
			<!-- <a class="button pull-right" style="margin-left:10px" href="/?m=Kxdr&c=Index&a=show_tools"><i class="icon-home"></i>{$L.SYS_RETURN}</a> -->
				
			<div class="button-group pull-right">
			  {include file='../../../PublicView/global_menu.html'}
			</div>
			</div>
		  </div>
		
      </div>
    </div>
		  
		<div class="panel">
		  <div class="panel-header clearfix">
			<h3 class="pull-left">请添加奖品</h3><button type="reset" class="button button-warning js-addgift pull-right">添加奖品</button>
			<div id="tbar" class="pull-right"></div>
		  </div>
		<div class="panel-body">
		<div class="flow-steps" style="margin:0 auto;width:948px">
		  {if !$eid}
		  <ol class="num3">
			<!-- <li class="first ">1.选择抽奖类型</li> -->
			<li class="first current-prev">1.设置抽奖参数</li>
			<li class="current">2.添加奖品</li>
			<li class="last">3.设置外观</li>
		  </ol>
		  {/if}
		  </div>
		  {if !$gifts}
		  <ul class="breadcrumb centered"><button type="reset" class="button button-mini button-warning js-addgift ">添加奖品</button>
		  </ul>
		  {else}
			<div class="gifts" style="position: relative;height:120px">
			  {foreach from=$gifts item=gift key=key}
			  <li class=" breadcrumb span3 gift{$key}" style="position:absolute">
				<p class="centered"><img src="{$gift.pic_url|cat:'_110x110'}" ></p>
				<p></p><h3 class="title64">{$gift.name}</h3><p></p>
				<p >所属等级：{$gift.level_name}<br />
				数量：{$gift.quantity_initial}份<br />
				剩余：{$gift.quantity}份<br />
				概率：{$gift.probability}%</p>
				{if $gift.advance}
				<p>
				<span class="label label-important">
				{if $gift.advance=="ev-lotts"}<i class="icon-user icon-white"></i>{/if}
				{if $gift.advance=="ev-minute"}<i class="icon-repeat icon-white"></i>{/if}
				{if $gift.advance=="time-range"}<i class="icon-calendar icon-white"></i>{/if}
				{$gift.advance_name}</span>
				</p>
					{if $gift.advance=="time-range"}
						<p>{$gift.range_time_start|date_format:"%m月%d日%H时"} 至<br />
						{$gift.range_time_end|date_format:"%m月%d日%H时"}<br />
						中出：{$gift.advance_quantity}件<br />
						概率：{$gift.advance_probability|default:0}%<br />
						其他时间按主概率中出</p>
					{/if}
					{if $gift.advance=="ev-minute"}
						<p>每隔{$gift.every_minute|default:0}分钟<br />
						中出：{$gift.advance_quantity|default:0}件<br />
						按概率直至中完。</p>
					{/if}
					{if $gift.advance=="ev-lotts"}
						<p>每{$gift.every_lotts|default:0}次抽奖<br />
						中出：{$gift.advance_quantity|default:0}件<br />
						按概率直至中完。</p>
					{/if}
				{/if}
				{if $gift.ext_rule}
				<p><span class="label label-info">{$gift.ext_rule_name}</span></p>
					{if $gift.ext_rule=="order"}
					<p>输入订单号兑换<br />
					金额：{$gift.payment}元<br />
					付款时间：<br />
					{$gift.pay_time_start|date_format:"%m月%d日"} 至 <br />
					{$gift.pay_time_end|date_format:"%m月%d日"}
					</p>
					{/if}{if $gift.ext_rule=="friend_show"}
					<p style="border:1px solid #EEE;padding:2px">{$gift.show_title}<br />
					{$gift.show_content}</p>
					{/if}
					{if $gift.ext_rule=="addcart"}
					<p>将{$gift.cart_items_count}件商品加入购物车<button data-items="{$gift.cart_items}" class="button button-mini js-cartset-preview">查看</button></p>
					<p class="auxiliary-text">加购物车只做引导，不判定是否真的加入</p>
					{/if}
					{if $gift.ext_rule=="collect"}
					<p>收藏{$gift.collect_items_count}件商品<button data-items="{$gift.collect_items}" class="button button-mini js-collect-preview">查看</button></p>
					<p class="auxiliary-text">收藏只做引导，不判定是否真的收藏</p>
					{/if}
					{if $gift.ext_rule=="metal"}
					<p>使用奖章兑换</p>
					<p>{$gift.medal_quant}个勋章：<br />【<img src="{$gift.medal_pic|cat:'_20x20'}" />{$gift.medal_name}】<br /></p>
					{/if}
					{if $gift.ext_rule=="jifen"}
					<p>使用{$gift.jifen|default:0}积分兑换</p>
					{/if}
					{if $gift.ext_rule=="password"}
					<p>凭密码：{$gift.password|default:0}领奖</p>
					{/if}
					{if $gift.rule_medal_id>0}
					<p>必须持有【{$gift.rule_medal_name|default:0}】奖章</p>
					{/if}
				{/if}
					{if $gift.per_user>0}
					<p>每人最多中出{$gift.per_user|default:0}份</p>
					{else}
					<p>不限制每个人中出的数量</p>
					{/if}
				<p class="auxiliary-text">
				<span class="x-icon x-icon-small x-icon-success js-edit" data-ac="edit" data-id="{$key}"><i class="icon icon-pencil icon-white"></i></span>
				<span class="x-icon x-icon-small x-icon-error js-edit" data-ac="delete" data-quant="{$gift.quantity}" data-id="{$key}" data-fid="{$gift.gift_id}"><i class="icon icon-trash icon-white"></i></span>
				</p>
				</li>
			  {/foreach}
			</div>
		  {/if}
			<div class="row form-actions actions-bar" style="margin-left:0">
				<div class="span13 offset10 ">
				{if !$eid}
					<!-- <a href="/?m=Shopmanage&c=event&a=step2">上一步</a> -->
					<a href="/?m=Shopmanage&c=event&a=step4&end_time={$end_time}" class="button"  >下一步</a>
				{else}
					<a href="/?m=Shopmanage&c=event" class="button save offset1" type="submmit" >完成</a>
				{/if}
				</div>
			</div>
		  </div>
		</div>
  </div>
  <div id="content" class="hide" style="overflow-y:scroll;height:600px">
 <form id="J_Form" class="form-horizontal">
		<input type="hidden" class="zmc" value="{$zmc}" />
		<input type="hidden" class="action" value="add" />
		<input type="hidden" class="egid" value="" />
		<input type="hidden" class="last_quant" value="" />
        <div class="row">
          <div class="control-group span15">
            <label class="control-label">奖品列表：</label>
            <div class="controls">
			<input type="hidden" class="gift-name" />
			<input type="hidden" class="gift-type" />
			<input type="hidden" class="gift-id" data-msg="请选择奖品" />
              <div id="s5">
				  <input type="hidden" class="js-hqjpval" value="b" name="hide">
				  <input name="id" type="text" class="input-small control-text js-hqjp" style="display:none" value="0">
			   <!-- <button type="reset" class="button button-small" style="margin-left:5px">增加</button> -->
			  <span class="auxiliary-text pull-right"><a href="/?m=Kxdr&c=Gift" target="_blank">添加</a></span>
			  </div>
            </div>
          </div>
        </div>
		<div class="row">
          <div class="control-group pic-row span15">
            <label class="control-label">主图：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-gift_pic"  style="display:none"   value="">
			  <img src="" class="gift-pic" />
            </div>
          </div>
        </div>
        <div class="row">
          <div class="control-group span15">
            <label class="control-label">所属等级：</label>
            <div class="controls">
			<div class="select_level">
			  <input name="id" type="text" class="pull-left input-small control-text hide js-level" style="display:none"  value="0">
            </div>
			</div>
			<div class="controls hide js-set-level_name " style="display:none" > 
			  <label class="pull-left">级别：</label>
			  <input name="id" type="text" class="pull-left control-text js-level_num span1" value="">
			</div>
			<div class="controls hide js-set-level_name " style="display:none" > 
			  <label class="pull-left">名称：</label>
			  <input name="id" type="text" class="pull-left input-small control-text js-level_name span1" value="">
			</div>
          </div>
        </div>
        <div class="row">
          <div class="control-group span15">
            <label class="control-label">奖品数量：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-quantity" value="0">
			   <div id="sl2" class="span5"  style="margin-top:8px"></div>
            </div>
          </div>
        </div>
        <div class="row ">
          <div class="control-group span15">
            <label class="control-label">概率：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-probability" style="background:url(http://img03.taobaocdn.com/imgextra/i3/44173724/TB2JPlHcpXXXXbvXXXXXXXXXXXX-44173724.jpg) 40px 5px no-repeat"  value="0">
			   <div id="sl1" class="span5"  style="margin-top:8px"></div>
            </div>
          </div>
        </div>
        <div class="row ">
          <div class="control-group span15">
            <label class="control-label">每人最多中出：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text span1 js-per_user" value="0">份<span class="auxiliary-text">（0为不限制）</span>
            </div>
          </div>
        </div>
		<hr />
        <div class="row ">
          <div class="control-group span15">
            <label class="control-label">高级概率：</label>
            <div class="controls">
			<input type="hidden" class="advance" value="no" />
			 <div class="button-group">
				<button type="button"  class="button button-mini span1 js-advance" data-advance="no">无</button>
				<button type="button"  class="button button-mini js-advance" data-advance="time-range">指定时段中出</button>
				<button type="button"  class="button button-mini js-advance" data-advance="ev-minute">每时间段中出</button>
				<button type="button"  class="button button-mini js-advance" data-advance="ev-lotts">每多少次中出</button>
			  </div>
            </div>
          </div>
        </div>
        <div class="row hide js-set-advance js-set-ev-minute">
          <div class="control-group span15">
            <label class="control-label">每时段：</label>
            <div class="controls">
			   <input name="id" type="text" class="pull-left input-small control-text js-every-minute"  value="0">分钟（以分钟做单位，从活动开始时间计算）
		    </div>
          </div>
        </div>
        <div class="row hide js-set-advance  js-set-time-range">
          <div class="control-group span15">
            <label class="control-label">指定时间段：</label>
            <div class="controls">
			  <input class="range_time_start calendar calendar-time" value="" data-tip="{ldelim}text : '付款时间'{rdelim}"  class="input-small calendar " type="text"><label>&nbsp;-&nbsp;</label>
              <input class="range_time_end calendar calendar-time" value="" data-tip="{ldelim}text : '付款时间'{rdelim}"  class="input-small calendar " type="text">
            </div>
          </div>
        </div>
        <div class="row hide js-set-advance  js-set-time-range">
          <div class="control-group span15">
            <label class="control-label">时段概率：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-time-range-prob" style="background:url(http://img03.taobaocdn.com/imgextra/i3/44173724/TB2JPlHcpXXXXbvXXXXXXXXXXXX-44173724.jpg) 0 5px no-repeat"  value="0">（时段概率优先级更高）
              <div id="time-range-prob" class="span5"  style="margin-top:8px"></div>
            </div>
          </div>
        </div>
        <div class="row hide js-set-advance js-set-ev-lotts">
          <div class="control-group span15">
            <label class="control-label">抽奖次数：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-every-lotts"  value="0">次（中出指定数量后，满足抽奖次数才会再次中出）
            </div>
          </div>
        </div>
        <div class="row hide js-set-advance js-set-etc-quantity">
          <div class="control-group span15">
            <label class="control-label">中出几份：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-advance_quantity"  value="0">
			   <div id="sl3" class="span5"  style="margin-top:8px"></div>
            </div>
          </div>
        </div>
		<hr />
        <div class="row">
          <div class="control-group span15">
            <label class="control-label">附加条件：</label>
            <div class="controls">
              <div id="s6">
				  <input type="hidden" class="js-ext-rule" value="b" name="hide" data-msg="{$L.EVENT_STEP3_PLS_SELECT_HQFS}">
				  <input name="id" type="text" class="input-small control-text js-hqfs" style="display:none" value="0">
			  </div>
            </div>
          </div>
        </div>
        <div class="row js-ext js-set-metal hide">
          <div class="control-group span15">
            <label class="control-label">勋章：</label>
            <div class="controls">
			<input name="medalid" type="hidden" class="pull-left input-small control-text js-medalid  bui-form-field" value="65" aria-disabled="false" style="display: none;">
			<input name="medal_name" class="pull-left input-small control-text js-medal_name  bui-form-field" type="hidden" value="" aria-disabled="false" style="display: none;">
			<input name="medal_pic" class="pull-left input-small control-text js-medal_pic  bui-form-field" type="hidden" value="" aria-disabled="false" style="display: none;">
			  <button type="button" data-tp="" class="button button-mini button-danger js-get-metal">选择</button>
			  <span class="medal"></span>
			  <input name="id" type="text" class="input span1 control-text js-medal_quant" value="1">个
            </div>
          </div>
        </div>
        <div class="row js-ext js-set-item hide">
          <div class="control-group control-row3 span15">
            <label class="control-label">收藏单品：</label>
            <div class="controls">
			<div class="tips tips-small tips-warning tips-no-icon">
			  <div class="tips-content">注意，收藏单品只做引导，不判定用户是否真的收藏过了。</div>
			</div>
				<input type="hidden" readonly="readonly" class="control-text span2 span-width collect_items form" value="" data-post="collect_items" >
				<input type="hidden" readonly="readonly" class="control-text span2 span-width collect_items_name form" value="" data-post="collect_items_name" >
				<input type="hidden" readonly="readonly" class="control-text span2 span-width collect_items_pic form" value="" data-post="collect_items_pic" >
				<span class="items-collect_items">0</span>件商品<button class="button button-mini button-danger js-itemset" type="button">设置</button><i class=""></i>
				<span class="auxiliary-text">
				必须收藏商品之后才可以领奖
				</span>
			</div>
          </div>
        </div>
        <div class="row js-ext js-set-cart hide">
          <div class="control-group control-row3 span15">
            <label class="control-label">加购物车：</label>
            <div class="controls">
			<div class="tips tips-small tips-warning tips-no-icon">
			  <div class="tips-content">注意，加购物车只做引导，不判定用户是否真的加购物车。</div>
			</div>
				<input type="hidden" readonly="readonly" class="control-text span2 span-width cart_items form" value="" data-post="cart_items" >
				<span class="items-cart_items">{$cfg.order_items_count|default:'0'}</span>件商品<button class="button button-mini button-danger js-cartset" type="button">设置</button><i class=""></i>
				<span class="auxiliary-text">
				必须加购物车之后才可以领奖。
				</span>
			</div>
          </div>
        </div>
        <div class="row js-ext js-set-passwd hide">
          <div class="control-group control-row3 span15">
            <label class="control-label">凭密码领奖：</label>
            <div class="controls">
			<div class="tips tips-small tips-warning tips-no-icon">
			  <div class="tips-content">在合适的地方公布密码，比如商品详情页。可输入字母。</div>
			</div>
				<input name="id" type="text" class="pull-left control-text js-passwd"   value="{$range}"> <button class="button button-mini button-warning js-random" type="button">随机</button>
			</div>
          </div>
        </div>
        <div class="row js-ext js-set-show-firend hide">
          <div class="control-group span15">
            <label class="control-label">炫耀标题：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left control-text js-show-title"   value="我中奖啦！">
            </div>
          </div>
        </div>
        <div class="row js-ext js-set-show-firend hide">
          <div class="control-group control-row4 span15">
            <label class="control-label">炫耀内容：</label>
            <div class="controls">
			  <textarea class="js-show-content">亲，我中奖啦！快来和我一起抽奖哦！</textarea>
            </div>
          </div>
        </div>
        <div class="row js-ext js-set-jifen hide">
          <div class="control-group span15">
            <label class="control-label">积分：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-jifen"   value="0">积分
            </div>
          </div>
        </div>
        <div class="row js-ext js-set-order hide">
          <div class="control-group span15">
            <label class="control-label">订单金额：</label>
            <div class="controls">
			  <input name="id" type="text" class="pull-left input-small control-text js-payment"   value="0">元以上已付款的订单
            </div>
          </div>
        </div>
        <div class="row js-ext js-set-order hide">
          <div class="control-group span15">
            <label class="control-label">订单付款时间：</label>
            <div class="controls bui-form-group" data-rules="{ldelim}dateRange : true{rdelim}">
              <input class="pay_time_start calendar" value="{$pay_time_start|default:""}" data-tip="{ldelim}text : '付款时间'{rdelim}"  class="input-small calendar " type="text"><label>&nbsp;-&nbsp;</label>
              <input class="pay_time_end calendar" value="{$pay_time_end|default:""}" data-tip="{ldelim}text : '付款时间'{rdelim}"  class="input-small calendar " type="text">
			</div>
          </div>
        </div>
        <div class="row js-ext js-set-order hide">
          <div class="control-group span15">
            <label class="control-label">订单包含商品：</label>
            <div class="controls">
				<input type="hidden" readonly="readonly" class="control-text span2 span-width order_items form" value="" data-post="order_items" >
				<span class="items-order_items">{$cfg.order_items_count|default:'0'}</span>件商品<button class="button button-mini button-danger js-orderset" type="button">设置</button><i class=""></i>
				<span class="auxiliary-text">
				订单包含指定的商品才可以兑换。
				</span>
			</div>
          </div>
        </div>
		<hr />
        <div class="row ">
          <div class="control-group span15">
            <label class="control-label">勋章条件：</label>
            <div class="controls">
			<input name="rule_medalid" type="hidden" class="pull-left input-small control-text js-rule_medalid  bui-form-field" value="" aria-disabled="false" style="display: none;">
			<input name="rule_medal_name" class="pull-left input-small control-text js-rule_medal_name  bui-form-field" type="hidden" value="" aria-disabled="false" style="display: none;">
			<input name="rule_medal_pic" class="pull-left input-small control-text js-rule_medal_pic  bui-form-field" type="hidden" value="" aria-disabled="false" style="display: none;">
			  <button type="button" class="button button-mini button-success js-rule_medal_c js-cancel-metal hide">取消</button>
			  <button type="button" data-tp="rule" class="button button-mini button-danger js-rule_medal js-get-metal">选择</button>
			  <span class="rule_medal"></span><span class="auxiliary-text pull-right">持有该勋章才可以领奖</span>
            </div>
          </div>
        </div>
    </form></div>
</body>
</html>